<template>
    <div>
        <el-dialog v-model="statusVisible" title="跟进记录" width="500">
            <div>
                <div class="title">是否添加微信</div>
                <el-radio-group v-model="add_wx">
                    <el-radio :label="1">是</el-radio>
                    <el-radio :label="0">否</el-radio>
                </el-radio-group>
                <div class="title">跟进记录</div>
                <el-input
                    v-model="follow_notice"
                    :autosize="{ minRows: 2, maxRows: 8 }"
                    type="textarea"
                    placeholder="请填写跟进记录"
                />
                
            </div>
            <template #footer>
              <div class="dialog-footer">
                  <el-button @click="() => {statusVisible = false}">取消</el-button>
                  <el-button type="primary" @click="onRight">确认</el-button>
              </div>
          </template>
        </el-dialog>
    </div>
</template>
<script lang="ts" setup name="statusDialog">
import { addFollow } from '@/api/demand/lists';
import feedback from '@/utils/feedback'

const statusVisible = ref(false)

defineExpose({
    dialogVisible(res: any){
        nextTick(()=>{
            init(res)
        })
    }
})
const emit = defineEmits(['change'])
const add_wx = ref('')
const follow_notice = ref('')
const demand_id = ref()

const init = async(data:any) => {
    console.log(data)
    statusVisible.value = true;
    demand_id.value = data.id;
    add_wx.value = data.add_wx;
    follow_notice.value =data.follow_notice;
}

const onRight = async () => {
    const res = await addFollow({
        id: demand_id.value,
        add_wx: add_wx.value,
        follow_notice: follow_notice.value
    })
    // feedback.msgSuccess('跟进记录添加成功')
    statusVisible.value = false;
    emit('change')
}


</script>
<style lang="scss" scoped>

.title{
    font-size: 14px;
    text-align: left;
    margin-bottom: 10px;
}
.result{
    font-size: 16px;
    .result-txt{
        color: #FF6900;
        font-weight: bold;
    }
}
</style>